package com.dinglian.ots.common;

import com.dinglian.ots.interceptor.AdminInterceptor;
import com.dinglian.ots.interceptor.RequestInterceptor;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.*;

import java.text.SimpleDateFormat;
import java.util.List;
import java.util.concurrent.TimeUnit;

@Configuration
public class AppConfig implements WebMvcConfigurer {

    @Bean
    public RequestInterceptor getRequestInterceptor() {
        return new RequestInterceptor();
    }

    @Bean
    public AdminInterceptor getAdminInterceptor() {
        return new AdminInterceptor();
    }

    //     拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       /* registry.addInterceptor(getRequestInterceptor())
                .excludePathPatterns("/user/**","/buyer/buyerRegister",
                        "/common/**"
                )
                .addPathPatterns("/brand/**", "/buyer/**", "/cart/**", "/common/getMessageList","/common/deleteMessage/**",
                        "/order/**", "/product/**");

        registry.addInterceptor(getAdminInterceptor())
                .addPathPatterns("/admin/index", "/admin/toExamineBuyer","/admin/toBrandRank","/admin/toProductRank","/admin/toTopBrandRank");*/
    }

}
